<?php

namespace app\admin\model\finance\extract;

use think\Model;

class School extends Model
{
    // 表名
    protected $name = 'finance_extract_school';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    protected $resultSetType = 'collection';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    
    // 追加属性
    protected $append = [
		'reg_level_text',
		'ranking_level_text',
        'level_text',
		'type_text',
    ];
    
    public function getRegLevelList()
    {
        return ['A' => __('School.Reg_level A'),'B' => __('School.Reg_level B'),'C' => __('School.Reg_level C')];
    }     
    public function getRegLevelTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['reg_level'];
        $list = $this->getRegLevelList();
        return isset($list[$value]) ? $list[$value] : '';
    }	
    public function getTypeList()
    {
        return ['1' => __('School.Type 1'),'2' => __('School.Type 2'),'3' => __('School.Type 3')];
    }     
	public function getTypeTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['type'];
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }
	public function getRankingLevelList()
    {
        return ['1' => __('School.Ranking_level 1'),'2' => __('School.Ranking_level 2'),'3' => __('School.Ranking_level 3')];
    }     
	public function getRankingLevelTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['ranking_level'];
        $list = $this->getRankingLevelList();
        return isset($list[$value]) ? $list[$value] : '';
    }
	public function getLevelList()
    {
        return ['A' => __('School.Level A'),'B' => __('School.Level B'),'C' => __('School.Level C')];
    }     
	public function getLevelTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['level'];
        $list = $this->getLevelList();
        return isset($list[$value]) ? $list[$value] : '';
    }
    







   /* public function data()
    {
        return $this->belongsTo('Data', 'id', 'extract_school', [], 'LEFT')->setEagerlyType(0);
    }*/
}
